<?php # Script 7.3 - handle_errors.php

$page_title = 'Handling Errors';
include('includes/header.html');
?>
	<div id="wrap">
		<div class="navbar navbar-inverse">
			<div class="navbar-inner">
				<div class="container">
					<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
					</a>
					<a class="brand" href="#">Your Website</a>
					<div class="nav-collapse collapse">
						<ul class="nav">
							<li class=""><a href="#">홈</a></li>
							<li class=""><a href="#">계산기</a></li>
							<li class=""><a href="#">날짜 폼</a></li>
							<li class=""><a href="#">link four</a></li>
							<li class=""><a href="#">link five</a></li>
						</ul>
					</div>
				</div>
			</div>
		</div>
		<div class="container">
			<div class="page-header">
    	<!-- Start of the page-specific content. -->
        	<h1>Testing Error Handling</h1>
        	
<?php

// Flag variable for site status:
define('LIVE', FALSE);

// Create the error handler:
function my_error_handler($e_number, $e_message, $e_file, $e_line, $e_vars) {

	// Build the error message:
	$message = "An error occured in script '$e_file' on line $e_line: $e_message\n";

	// Append $e_vars to $message:
	$message .= print_r($e_vars, 1);

	if (!LIVE) { // Development (print the error).
		echo '<pre>' . $message . "\n";
		debug_print_backtrace();
		echo '</pre><br/>';
	} else { // Don't show the error.
		echo '<div class="error">A system error occurred. We apologize for the inconvenience.</div><br/>';
	}

} // End of my_error_handler() definition.

// Use my error handler:
set_error_handler('my_error_handler');

// Create errors:
foreach ($var as $v) {}
$result = 1/0;
?>
<?php
include('includes/footer.html');
?>